<?php

	/*
		----------------------------------
		Projet Lumina
		----------------------------------
		
		Classe Dead, correspondant à la table dead 
		de la base de données
		
		COHEN Jonathan
		2014
	*/
	
	class Dead {
		var $id;
		var $last_name;
		var $first_name;
		var $birth_date;
		var $death_date;
		var $photo;
		var $roses;
		var $description;
		
		function __construct($id, $last_name, $first_name, $birth_date, $death_date, $photo, $roses, $description) {
			$this->setId($id);
			$this->setLastName($last_name);
			$this->setFirstName($first_name);
			$this->setBirthDate($birth_date);
			$this->setDeathDate($death_date);
			$this->setPhoto($photo);
			$this->setRoses($roses);
			$this->setDescription($description);
		}
		
		
		/* ------------------------------
			GETTERS GÉNÉRIQUES
		*/
		function getId() {
			return $this->id;
		}
		
		function getLastName() {
			return $this->last_name;
		}
		
		function getFirstName() {
			return $this->first_name;
		}
		
		function getBirthDate() {
			return $this->birth_date;
		}
		
		function getDeathDate() {
			return $this->death_date;
		}
		
		function getPhoto() {
			return $this->photo;
		}
		
		function getRoses() {
			return $this->roses;
		}
		
		function getDescription() {
			return $this->description;
		}
		
		
		/* ------------------------------
			GETTERS PERSONNALISÉS
		*/
		function getAge() {
			return intval(explode("-", $this->death_date)[0]) - intval(explode("-", $this->birth_date)[0]);
		}
		
		function getBirthDateYear() {
			return (explode("-", $this->birth_date)[0]);
		}
		
		function getDeathDateYear() {
			return (explode("-", $this->death_date)[0]);
		}
		
		
		/* ------------------------------
			SETTERS
		*/
		function setId($id) {
			$this->id = $id;
		}
		
		function setLastName($last_name) {
			$this->last_name = $last_name;
		}
		
		function setFirstName($first_name) {
			$this->first_name = $first_name;
		}
		
		function setBirthDate($birth_date) {
			$this->birth_date = $birth_date;
		}
		
		function setDeathDate($death_date) {
			$this->death_date = $death_date;
		}
		
		function setPhoto($photo) {
			$this->photo = $photo;
		}
		
		function setRoses($roses) {
			$this->roses = $roses;
		}
		
		function setDescription($description) {
			$this->description = $description;
		}
	}

?>